/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import connection.LoginDB;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.DatatypeConverter;

/**
 *
 * @author Admin
 */
public class UserAccount {
   private  int userid;
   private String username;
   private String password;
   private String fullname;
   private String dateofbirth;
   private String email;
   private String phonenuber;
   private String image;

    public UserAccount(int userid, String username, String password, String fullname, String dateofbirth, String email, String phonenuber, String image) {
        this.userid = userid;
        this.username = username;
        this.password = password;
        this.fullname = fullname;
        this.dateofbirth = dateofbirth;
        this.email = email;
        this.phonenuber = phonenuber;
        this.image = image;
    }

    public UserAccount(String username, String password, String fullname, String dateofbirth, String email, String phonenuber, String image) {
        this.username = username;
        this.password = password;
        this.fullname = fullname;
        this.dateofbirth = dateofbirth;
        this.email = email;
        this.phonenuber = phonenuber;
        this.image = image;
    }

    public UserAccount(int userid, String username, String password) {
        this.userid = userid;
        this.username = username;
        this.password = password;
    }

    public int getUserid() {
        return userid;
    }

    public void setUserid(int userid) {
        this.userid = userid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        try {
            MessageDigest md = MessageDigest.getInstance("md5");
            byte[] output = md.digest(password.getBytes());
            return DatatypeConverter.printHexBinary(output);
        } catch (NoSuchAlgorithmException ex) {
            Logger.getLogger(LoginDB.class.getName()).log(Level.SEVERE, null, ex);
        }
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getDateofbirth() {
        return dateofbirth;
    }

    public void setDateofbirth(String dateofbirth) {
        this.dateofbirth = dateofbirth;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhonenuber() {
        return phonenuber;
    }

    public void setPhonenuber(String phonenuber) {
        this.phonenuber = phonenuber;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }
   
}
